<!DOCTYPE html>
<html>
<head>
    <title>网址大全</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="./webjars/bootstrap/4.5.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="./css/common.css">
    <script src="./webjars/jquery/3.4.1/jquery.min.js"></script>
    <script src="./webjars/popper.js/1.16.0/popper.min.js"></script>
    <script src="./webjars/bootstrap/4.5.3/js/bootstrap.min.js"></script>
    <script src="./webjars/layer/dist/layer.js"></script>
    <link rel="icon" href="./img/favicon.ico" type="image/x-icon"/>
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon"/>
    <style>
        .td-text {
            height: 100px;
            justify-content: center;
            display: flex;
            flex-direction: column;
            word-wrap: break-word;
            word-break: break-all;
        }

        .td-img {
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
<div id="head">
</div>
<script>
    $("#head").load("./head.html", function () {
        $("#collections").addClass("active");
    });
</script>
<div class="container mt-5">
    <div class="container  mt-3 pt-3">
        <table class="table table-hover" id="sitesTable">
            <thead>
            <tr>
                <th width="100">图标</th>
                <th width="300">标题</th>
                <th>描述</th>
            </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
    </div>
</div>
</body>
<script>
    var sites = [
        {
            title: "百度",
            icon: "./img/favicon.ico",
            detail: "keyword find world",
            url: "https://www.baidu.com/"
        },


    ];

    function goSites(e) {
        window.open($(e).attr("url"));
    }

    function createTd(item) {
        return "<tr url='" + item.url + "' onclick='goSites(this)'>" +
            "   <td><img src='" + item.icon + "' alt='icon' class='td-img'></td>" +
            "   <td><div class='td-text'>" + item.title + "</div></td>" +
            "   <td><div class='td-text'>" + item.detail + "<br>" + item.url + "</div></td>" +
            "</tr>";
    }

    $(document).ready(function () {
        for (let i = 0; i < sites.length; i++) {
            $("#sitesTable").append(createTd(sites[i]));
        }
    })
</script>
</html>
